#include<iostream>
using namespace std;
const int N = 3010;
int arr[N];
int a, k, b;
int n, m;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		scanf("%d", &n);
		for (int i = 1; i <= n; i++) {
			scanf("%d", &arr[i]);
		}
		scanf("%d%d%d", &a, &k, &b);
		scanf("%d", &m);
		while (m--) {
			for (int i = 1; i <= n; i++) {
				arr[i] += a;
			}	
			for (int i = 1; i <= n; i++) {
				if (arr[i] > k) {
					arr[i] = b;
				}
			}
		}
		for (int i = 1; i <= n; i++) {
			printf("%d ", arr[i]);
		}
		printf("\n");
	}
	return 0;
}